<template>
  <a-card :bordered="false">
    <!-- 查询区域 -->
    <div>
      <a-form @keyup.enter.native="searchQuery">
        <a-row :gutter="24">
          <a-col :md="6" :sm="12">
            <a-form-item label="数据源名称" :labelCol="labelCol" :wrapperCol="wrapperCol">
              <a-input placeholder="请输入数据源名称" v-model="queryParam.name"></a-input>
            </a-form-item>
          </a-col>
          <a-col :md="6" :sm="8">
            <a-form-item>
              <a-button type="primary" @click="searchQuery()" icon="search">查询</a-button>
              <a-button type="primary" @click="searchReset()" icon="reload" style="margin-left: 8px">重置</a-button>
            </a-form-item>
          </a-col>
        </a-row>
      </a-form>
    </div>
    <div>
      <vxe-grid
        id="MultitenantDsList"
        ref="vxeTable"
        v-bind="gridOptions"
        :row-config="{keyField:'id'}"
        :pagerConfig="false"
      >
      <template #action="{ row }">
        <!-- <a @click="handleEdit(row)">编辑</a> -->
        <a-divider type="vertical" />
        <a-dropdown>
          <a class="ant-dropdown-link">
            更多 <a-icon type="down" />
          </a>
          <a-menu slot="overlay">
            <a-menu-item>
              <a href="javascript:;" @click="handleDetail(row)">详情</a>
            </a-menu-item>
            <!-- <a-menu-item v-if="row.status === '01'">
              <a-popconfirm title="确定删除吗?" @confirm="() => handleDelete(row.code)">
                <a>删除</a>
              </a-popconfirm>
            </a-menu-item> -->
          </a-menu>
        </a-dropdown>
      </template>
    </vxe-grid>
    </div>
    <MultitenantDsModal @ok="modalFormOk" ref="modalForm" />
  </a-card>
</template>

<script>
import VxeTableListMixin from '@/mixins/VxeTableListMixin'
import MultitenantDsModal from './modules/MultitenantDsModal'
export default {
  name: 'MultitenantDsList',
  components: { MultitenantDsModal },
  mixins: [VxeTableListMixin],
  data() {
    return {
      columns: [
        { type: 'seq', width: 60 },
        { title: '数据源名称', field: 'name' },
        { title: '数据源URL', field: 'url' },
        { title: '数据源用户名', field: 'username' },
        { title: '类型', field: 'type' },
        { title: '数据源驱动', field: 'driverClassName' },
        { title: 'JNDI名称', field: 'jndiName' },
        { title: '是否共享', field: 'shared', slots: { default: ({ row }) => {
          if (row.shared) {
            return '是'
          } else {
            return '否'
          }
        } }},
        { title: '是否有效', field: 'enabled', slots: { default: ({ row }) => {
          if (row.enabled) {
            return '是'
          } else {
            return '否'
          }
        } }},
        { title: '用量', field: 'depletionIndex' },
        { title: '操作', slots: { default: 'action' }, width: 170 }
      ],
      url: {
        list: '/multitenant/ds/list',
        delete: '/camunda/flow/remove/'
      }
    }
  },
  methods: {

  }
}
</script>

